<!-- 打分结果页面 -->
<template>
    <div class="app-container">
        <el-row>
            <el-col :offset="10">
                <p>考试结果</p>
            </el-col>
            <el-col>
                <el-row>
                    <el-col :span="20">
                        <p>卷名:{{ paperResult.examPaperName }}</p>
                    </el-col>
                    <el-col :span="4">
                        <p>得分：{{ paperResult.resultScore }}</p>
                    </el-col>
                </el-row>
                <el-divider></el-divider>
            </el-col>
        </el-row>
        <el-row>
            <el-col v-for="(item, index) in quesitonList" :key="index">
                <p>{{ item.questionName }}（4分）{{ item.quesitonType.setVal }}</p>
                <!-- 单选，多选，判断需要循环显示答案 -->
                <el-col
                    v-if="item.quesitonType.setType == 1 || item.quesitonType.setType == 2 || item.quesitonType.setType == 3">
                    <div v-for="(answuer, index) in item.question.quAnswers">
                        <el-checkbox v-model="checked" disabled border style="width: 100%;">{{answuer.answerOption}}.{{ answuer.quAnswerContent
                        }}</el-checkbox>
                    </div>
                    <el-col>
                        <span>正确选项：</span>
                        <el-tag type="success">{{ item.quChooseAnswer }}</el-tag>
                    </el-col>
                    <el-col>
                        <span>选择选项：</span>
                        <el-tag type="success">{{ item.chooseOptionA }}</el-tag>
                    </el-col>
                    <el-col>
                        <span>答题结果：</span>
                        <el-tag type="success">{{ item.isCorrect == 1 ? '√' : '×' }}</el-tag>
                    </el-col>
                </el-col>
                <el-col v-else>
                    <div>
                        <el-card class="box-card">
                            <div>
                                答： {{ item.chooseOption }}
                            </div>
                        </el-card>
                    </div>
                    <div>
                        <el-card class="box-card">
                            <div>
                                <span>问题解析：</span>{{ item.question.analysis }}
                            </div>
                        </el-card>
                    </div>
                </el-col>
            </el-col>


        </el-row>
    </div>
</template>
<script>
import { examResult } from '@/api/onlineQuestion/paperQuestion'
import { tsQualifiedName } from '@babel/types';
export default {
    data() {

        return {
            paperResult: {},
            quesitonList: [],
            checked:false

        }
    },
    created() {
        this.examResult();

    },
    methods: {
        // 获取打分结果
        examResult() {
            examResult({
                examResultId:this.$route.params.examResultId
            }).then(res => {
                if (res.code === 200) {
                    this.paperResult = res.data
                    this.quesitonList = JSON.parse(res.data.paperContent);
                }
            })

        },

    }


}
</script>
<style scoped>
.text {
    font-size: 14px;
}

.item {
    padding: 18px 0;
}

.box-card {
    width: 100%;
}

span {
    color: brown;
}
el-tag{
    margin-top: 10px;
    margin-left: 10px;
}
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>